/**  File: displaybar.cpp
 *   Author: Jaideep Balekar
 *           Department of Computer Science
 *           Texas A&M University
 *           315 - Programming Studio
 * Due Date: December 6th, 2009 @ 11:59
 * Contents: This class builds and shows the display bar on the GUI window. It displays the player score, level and lives left.
 */
 #include "displaybar.h" 
 
 #include <QGraphicsScene>
 #include <QApplication>
 #include <QFont>
 #include <QFrame>
 #include <QGridLayout>
 #include <QLCDNumber>
 #include <QPushButton>
 #include <QSlider>
 #include <QVBoxLayout>
 #include <QWidget>

DisplayBar::DisplayBar(QWidget *parent) : QWidget(parent)
{

QHBoxLayout *hb = new QHBoxLayout;
    levelLabel.setText("Level: ");
    level = new QLCDNumber();
    level->setFrameStyle( QFrame::NoFrame );
    level->setSegmentStyle( QLCDNumber::Flat );
    level->setFixedWidth( 100 );
    hb->addWidget(&levelLabel);
    hb->addWidget(level);

    lifeLabel.setText("Lives: ");
    life = new QLCDNumber();
    life->setFrameStyle( QFrame::NoFrame );
    life->setSegmentStyle( QLCDNumber::Flat );
    life->setFixedWidth( 150);
    hb->addWidget(&lifeLabel);
    hb->addWidget(life);

    scoreLabel.setText("Score: ");
    score = new QLCDNumber();
    score->setFrameStyle( QFrame::NoFrame );
    score->setSegmentStyle( QLCDNumber::Flat );
    score->setFixedWidth( 150 );
    hb->addWidget(&scoreLabel);
    hb->addWidget(score);

    setLayout(hb);
 }
 
 void DisplayBar::updateScore(int newScore)
{
    score->display(newScore);
}

void DisplayBar::updateLevel(int newLevel)
{
    level->display(newLevel+1);
}


void DisplayBar::updateLives(int newLives)
{
    life->display(newLives);
}
